package com.hsc.yalebao.tabMine;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.Editable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.State;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.handmark.pulltorefresh.library.extras.SoundPullEventListener;
import com.hsc.yalebao.adapter.GetAgentDailiListtAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.GetAgentUserListBean;
import com.hsc.yalebao.model.GetAgentUserListBeanModel;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import okhttp3.Call;

public class LookDownDailiActivity extends BaseActivity
{
  private static Context context;
  private String TAG = "LookDownDailiActivity";
  private GetAgentDailiListtAdapter adapter;
  private Calendar calendar;
  private String cengji;
  private View emptyView;
  private EditText et_daili_cengji;
  private EditText et_month;
  private EditText et_year;
  private ImageView img_xiala_cengji;
  private ImageView img_xiala_month;
  private ImageView img_xiala_year;
  private ImageView iv_title_right;
  private PullToRefreshListView mPullRefreshListView;
  private int mYear;
  private int memberid;
  private String mmonth1;
  private int nowMonth;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
        CustomApplication.app.finishActivity(LookDownDailiActivity.this);
        return;
      case 2131099879:
        LookDownDailiActivity.this.popupWindowscengji();
        return;
      case 2131099882:
        LookDownDailiActivity.this.showyearPopwindow();
        return;
      case 2131099885:
      }
      LookDownDailiActivity.this.showmonthPopwindow();
    }
  };
  PopupWindow popupWindownian;
  PopupWindow popupWindowscengji;
  PopupWindow popupWindowsyue;
  private ArrayList<GetAgentUserListBeanModel> result = new ArrayList();
  private RelativeLayout rl_daili_cengji;
  private RelativeLayout rl_month;
  private RelativeLayout rl_year;
  private TextView tv_tishi;
  private String yearStr = "2016";

  private void GetAgentProfitList()
  {
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    HashMap localHashMap = new HashMap();
    localHashMap.put("memberid", this.memberid);
    localHashMap.put("month", this.mmonth1);
    localHashMap.put("year", this.yearStr);
    int i;
    if ("全部".equals(this.cengji))
      i = 2;
    for (String str = "9"; ; str = this.cengji)
    {
      localHashMap.put("depth", str);
      localHashMap.put("ctype", i);
      LogUtils.e(this.TAG, "memberid=" + this.memberid + "year=" + this.yearStr + "depth:" + str + "ctype=" + i + "month=" + this.mmonth1);
      LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_GETAGENTUSERLIST);
      showLoadingDialog();
      RequestNet.get(context, AppConstants.URL_GET_GETAGENTUSERLIST, localHashMap, new StringCallback()
      {
        public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
        {
          LookDownDailiActivity.this.dismissLoadingDialog();
          LogUtils.e(LookDownDailiActivity.this.TAG, "获取失败, 获取代理商下代理列表:" + paramAnonymousException);
        }

        public void onResponse(String paramAnonymousString)
        {
          LookDownDailiActivity.this.dismissLoadingDialog();
          LookDownDailiActivity.this.mPullRefreshListView.onRefreshComplete();
          LogUtils.d(LookDownDailiActivity.this.TAG, "result:" + paramAnonymousString);
          if (UiUtil.IsValueEmpty(paramAnonymousString))
          {
            LogUtils.d(LookDownDailiActivity.this.TAG, "result:" + paramAnonymousString);
            LookDownDailiActivity.this.mPullRefreshListView.setEmptyView(LookDownDailiActivity.this.emptyView);
          }
          GetAgentUserListBean localGetAgentUserListBean;
          do
          {
            return;
            Gson localGson = new Gson();
            try
            {
              localGetAgentUserListBean = (GetAgentUserListBean)localGson.fromJson(paramAnonymousString, GetAgentUserListBean.class);
              if (localGetAgentUserListBean == null)
              {
                LookDownDailiActivity.this.mPullRefreshListView.setEmptyView(LookDownDailiActivity.this.emptyView);
                LogUtils.e(LookDownDailiActivity.this.TAG, "getAgentUserListBean == null");
                return;
              }
            }
            catch (Exception localException)
            {
              while (true)
              {
                localException.printStackTrace();
                localGetAgentUserListBean = null;
              }
              if (localGetAgentUserListBean.getFlag() == 0)
              {
                LookDownDailiActivity.this.mPullRefreshListView.setEmptyView(LookDownDailiActivity.this.emptyView);
                LogUtils.e(LookDownDailiActivity.this.TAG, "getAgentUserListBean.getFlag() ==0");
                return;
              }
              if (localGetAgentUserListBean.getFlag() == -2)
              {
                LookDownDailiActivity.this.showDownWireDialog();
                return;
              }
              if (localGetAgentUserListBean.getFlag() == -3)
              {
                LookDownDailiActivity.this.ShowFengjinDialog();
                return;
              }
              if (localGetAgentUserListBean.getFlag() == -4)
              {
                LookDownDailiActivity.activityStack.backToMain(MainActivity.class, LookDownDailiActivity.context);
                return;
              }
            }
          }
          while (localGetAgentUserListBean.getFlag() != 1);
          if (localGetAgentUserListBean.getResult() == null)
          {
            LogUtils.e(LookDownDailiActivity.this.TAG, "getAgentUserListBean.getResult() == null");
            return;
          }
          LookDownDailiActivity.this.result.clear();
          LookDownDailiActivity.this.result.addAll(localGetAgentUserListBean.getResult());
          if ((LookDownDailiActivity.this.result == null) || (LookDownDailiActivity.this.result.size() == 0))
          {
            LookDownDailiActivity.this.tv_tishi.setText("暂无数据");
            LookDownDailiActivity.this.mPullRefreshListView.setEmptyView(LookDownDailiActivity.this.emptyView);
            LogUtils.e(LookDownDailiActivity.this.TAG, "result == null || result.size() == 0");
          }
          LookDownDailiActivity.this.adapter.setData(LookDownDailiActivity.this.result);
          LookDownDailiActivity.this.adapter.notifyDataSetChanged();
        }
      });
      return;
      i = 1;
    }
  }

  private void init()
  {
    this.et_daili_cengji = ((EditText)findViewById(2131099880));
    this.et_year = ((EditText)findViewById(2131099883));
    this.et_year.setText(this.calendar.get(1) + "年");
    this.et_month = ((EditText)findViewById(2131099886));
    this.et_month.setInputType(0);
    this.nowMonth = (1 + this.calendar.get(2));
    if (this.nowMonth < 10)
      this.et_month.setText("0" + this.nowMonth + " 月");
    while (true)
    {
      this.et_year.setInputType(0);
      this.et_daili_cengji.setInputType(0);
      this.rl_year = ((RelativeLayout)findViewById(2131099882));
      this.rl_year.setOnClickListener(this.onClickListener);
      this.rl_daili_cengji = ((RelativeLayout)findViewById(2131099879));
      this.rl_daili_cengji.setOnClickListener(this.onClickListener);
      this.rl_month = ((RelativeLayout)findViewById(2131099885));
      this.rl_month.setOnClickListener(this.onClickListener);
      this.img_xiala_year = ((ImageView)findViewById(2131099884));
      this.img_xiala_month = ((ImageView)findViewById(2131099887));
      this.img_xiala_cengji = ((ImageView)findViewById(2131099881));
      this.emptyView = LayoutInflater.from(context).inflate(2130903139, null);
      this.tv_tishi = ((TextView)this.emptyView.findViewById(2131100053));
      this.tv_tishi.setText("获取中...");
      this.mPullRefreshListView = ((PullToRefreshListView)findViewById(2131099717));
      this.mPullRefreshListView.setEmptyView(this.emptyView);
      this.mPullRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
      SoundPullEventListener localSoundPullEventListener = new SoundPullEventListener(this);
      localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.PULL_TO_REFRESH, 2131034114);
      localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.RESET, 2131034116);
      localSoundPullEventListener.addSoundEvent(PullToRefreshBase.State.REFRESHING, 2131034115);
      if (this.adapter == null)
      {
        this.adapter = new GetAgentDailiListtAdapter(context, this.result);
        this.mPullRefreshListView.setAdapter(this.adapter);
      }
      this.adapter.notifyDataSetChanged();
      return;
      this.et_month.setText(this.nowMonth + " 月");
    }
  }

  @SuppressLint({"NewApi"})
  @TargetApi(12)
  private void popupWindowscengji()
  {
    this.img_xiala_cengji.setImageResource(2130837882);
    View localView = LayoutInflater.from(context).inflate(2130903173, null);
    final PopupWindow localPopupWindow = new PopupWindow(localView, this.rl_daili_cengji.getWidth(), 400, true);
    ListView localListView = (ListView)localView.findViewById(2131100233);
    final String[] arrayOfString = { "全部", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
    localListView.setAdapter(new ArrayAdapter(context, 2130903047, arrayOfString));
    localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        try
        {
          LookDownDailiActivity.this.et_daili_cengji.setText(arrayOfString[paramAnonymousInt]);
          LookDownDailiActivity.this.cengji = LookDownDailiActivity.this.et_daili_cengji.getText().toString();
          LookDownDailiActivity.this.img_xiala_cengji.setImageResource(2130837881);
          LookDownDailiActivity.this.GetAgentProfitList();
          localPopupWindow.dismiss();
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localPopupWindow.setOutsideTouchable(true);
    localPopupWindow.setFocusable(true);
    localPopupWindow.setBackgroundDrawable(context.getResources().getDrawable(2130838170));
    localPopupWindow.showAsDropDown(this.et_daili_cengji, 0, 0);
  }

  @SuppressLint({"NewApi"})
  @TargetApi(12)
  private void showmonthPopwindow()
  {
    this.img_xiala_month.setImageResource(2130837882);
    View localView = LayoutInflater.from(context).inflate(2130903173, null);
    final PopupWindow localPopupWindow = new PopupWindow(localView, this.rl_daili_cengji.getWidth(), 400, true);
    ListView localListView = (ListView)localView.findViewById(2131100233);
    final String[] arrayOfString = { "01 月", "02 月", "03 月", "04 月", "05 月", "06 月", "07 月", "08 月", "09 月", "10 月", "11 月", "12 月" };
    localListView.setAdapter(new ArrayAdapter(context, 2130903047, arrayOfString));
    localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        try
        {
          LookDownDailiActivity.this.et_month.setText(arrayOfString[paramAnonymousInt]);
          LookDownDailiActivity.this.mmonth1 = (paramAnonymousInt + 1);
          LookDownDailiActivity.this.img_xiala_month.setImageResource(2130837881);
          LookDownDailiActivity.this.GetAgentProfitList();
          localPopupWindow.dismiss();
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localPopupWindow.setOutsideTouchable(true);
    localPopupWindow.setFocusable(true);
    localPopupWindow.setBackgroundDrawable(context.getResources().getDrawable(2130838170));
    localPopupWindow.showAsDropDown(this.et_month, 0, 0);
  }

  @SuppressLint({"NewApi"})
  @TargetApi(12)
  private void showyearPopwindow()
  {
    this.img_xiala_year.setImageResource(2130837882);
    View localView = LayoutInflater.from(context).inflate(2130903173, null);
    final PopupWindow localPopupWindow = new PopupWindow(localView, this.rl_year.getWidth(), 2 * this.rl_year.getHeight(), true);
    ListView localListView = (ListView)localView.findViewById(2131100233);
    int i = this.calendar.get(1);
    final String[] arrayOfString = new String[2];
    arrayOfString[0] = (i - 1);
    arrayOfString[1] = i;
    localListView.setAdapter(new ArrayAdapter(context, 2130903047, arrayOfString));
    localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
      public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
      {
        try
        {
          LookDownDailiActivity.this.et_year.setText(arrayOfString[paramAnonymousInt] + "年");
          LookDownDailiActivity.this.yearStr = arrayOfString[paramAnonymousInt];
          LookDownDailiActivity.this.img_xiala_year.setImageResource(2130837881);
          LookDownDailiActivity.this.GetAgentProfitList();
          localPopupWindow.dismiss();
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localPopupWindow.setOutsideTouchable(true);
    localPopupWindow.setFocusable(true);
    localPopupWindow.setBackgroundDrawable(context.getResources().getDrawable(2130838170));
    localPopupWindow.showAsDropDown(this.et_year, 0, 0);
  }

  @TargetApi(19)
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903064);
    CustomApplication.app.addActivity(this);
    context = this;
    this.calendar = Calendar.getInstance();
    setTitle(8, 0, 2130837809, "代理分红", 0, 8, 8, 0, true);
    init();
  }

  protected void onResume()
  {
    super.onResume();
    this.cengji = "全部";
    this.mmonth1 = this.nowMonth;
    GetAgentProfitList();
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabMine.LookDownDailiActivity
 * JD-Core Version:    0.6.2
 */